CFLAGS = -Wall -g
INCLUDES = -Iinclude

vie: main.c vie.o ui.o buffer.o undo.o exbuf.o cmdbuf.o tabmap.o cmdmap.o command.o search.o fileio.o clipboard.o window.o highlight.o
	gcc $(CFLAGS) $(INCLUDES) -lncurses -o vie $^

buffer.o: buffer.c include/buffer.h include/window.h include/list.h
	gcc $(CFLAGS) $(INCLUDES) -c buffer.c

undo.o: undo.c include/undo.h include/buffer.h include/window.h include/list.h
	gcc $(CFLAGS) $(INCLUDES) -c undo.c

ui.o: ui.c include/ui.h include/structs.h
	gcc $(CFLAGS) $(INCLUDES) -c ui.c

exbuf.o: exbuf.c include/exbuf.h
	gcc $(CFLAGS) $(INCLUDES) -c exbuf.c

cmdbuf.o: cmdbuf.c include/cmdbuf.h
	gcc $(CFLAGS) $(INCLUDES) -c cmdbuf.c

cmdmap.o: cmdmap.c include/cmdmap.h	
	gcc $(CFLAGS) $(INCLUDES) -c cmdmap.c

command.o: command.c include/command.h
	gcc $(CFLAGS) $(INCLUDES) -c command.c

tabmap.o: tabmap.c include/tabmap.h
	gcc $(CFLAGS) $(INCLUDES) -c tabmap.c

vie.o: vie.c include/vie.h
	gcc $(CFLAGS) $(INCLUDES) -c vie.c 

search.o: search.c include/search.h include/buffer.h
	gcc $(CFLAGS) $(INCLUDES) -c search.c

fileio.o: fileio.c include/fileio.h include/buffer.h include/window.h
	gcc $(CFLAGS) $(INCLUDES) -c fileio.c

clipboard.o: clipboard.c include/clipboard.h
	gcc $(CFLAGS) $(INCLUDES) -c clipboard.c

window.o: window.c include/window.h include/buffer.h include/undo.h include/list.h
	gcc $(CFLAGS) $(INCLUDES) -c window.c
	
highlight.o: highlight.c include/highlight.h
	gcc $(CFLAGS) $(INCLUDES) -c highlight.c

clean:
	rm buffer.o undo.o ui.o vie.o exbuf.o cmdbuf.o cmdmap.o tabmap.o command.o search.o fileio.o clipboard.o window.o highlight.o vie 

